import {
	createRouter,
	createWebHistory
} from 'vue-router'
import Home from '../views/Home.vue'
//获取环境变量，Vite 会自动替换这里的值
const base = import.meta.env.VITE_BASE_URL || '/'
const router = createRouter({
	history: createWebHistory(base),
	routes: [{
			path: '/',
			redirect: 'home'
		},
		{
			path: '/home',
			name: 'Home',
			component: Home,
		},
		{
			path: '/shopping',
			name: 'Shopping',
			component: () => import('../views/shopping.vue'),
		},
		{
			path: '/live',
			name: 'Live',
			component: () => import('../views/Live.vue'),
		},
		{
			path: '/my',
			name: 'My',
			component: () => import('../views/My.vue'),
		},
		{
			path: '/search',
			name: 'Search',
			redirect: {name:'index'},
			children: [{
					path: '/index',
					name: 'index',
					component: () => import('../views/SearchIndex.vue'),
				},
				{
					path: 'list',
					name: 'list',
					component: () => import('../views/SearchList.vue'),
				},
			],
			component: () => import('../views/Search.vue'),
		},
		{
			path: '/sort',
			name: 'Sort',
			component: () => import('../views/Sort.vue'),
		},
		{
			path: '/detail',
			name: 'Detail',
			// meta:{KeepAlive:false},
			component: () => import('../views/Detail.vue'),
		},
		{
			path: '/login',
			name: 'Login',
			component: () => import('../views/login/Login.vue'),
		},
		
	],
})
export default router